home *** CD-ROM | disk | FTP | other *** search
/ My Neighborhood / My Neighborhood.iso / mac / MacFiles / Shared.Dir / 00908.ls < prev    next >
Encoding:
Text File  |  1997-11-20  |  1.3 KB  |  45 lines

  1. on dragItem hVals, snapV, useNextMember, constrainSprite
  2.   global mySprite
  3.   set startH to the locH of sprite mySprite
  4.   set startV to the locV of sprite mySprite
  5.   if paramCount() < 3 then
  6.     set useNextMember to 0
  7.   end if
  8.   if paramCount() >= 4 then
  9.     set the constraint of sprite mySprite to constrainSprite
  10.   end if
  11.   if not listp(hVals) then
  12.     set snapH to hVals
  13.     set hVals to list(hVals)
  14.   end if
  15.   puppetSound(0)
  16.   repeat while the stillDown
  17.     set x to the mouseH
  18.     set y to the mouseV
  19.     set snapped to 0
  20.     repeat with snapH in hVals
  21.       if inside(point(x, y), rect(snapH - 70, snapV - 35, snapH + 70, snapV + 35)) then
  22.         set snapped to 1
  23.         if (the locH of sprite mySprite <> snapH) or (the locV of sprite mySprite <> snapV) then
  24.           puppetSound("poper")
  25.           set the visible of sprite 20 to 1
  26.           set the locH of sprite mySprite to snapH
  27.           set the locV of sprite mySprite to snapV
  28.         end if
  29.       end if
  30.     end repeat
  31.     if not snapped then
  32.       set the locH of sprite mySprite to the mouseH
  33.       set the locV of sprite mySprite to the mouseV
  34.       set the visible of sprite 20 to 0
  35.     end if
  36.     updateStage()
  37.   end repeat
  38.   set the constraint of sprite mySprite to 0
  39.   if not snapped then
  40.     return 0
  41.   else
  42.     return 1
  43.   end if
  44. end
  45.